import request from '@/utils/request'

export function getManagerUser(params) {
  return request({
    url: '/manager/user/query',
    method: 'get',
    params
  })
}

export function getManagerCourse(data) {
  return request({
    url: '/manager/course/query',
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  }).then(result => {
    return result
  })
}

export function getCourseCategory(params) {
  return request({
    url: '/manager/course/category',
    method: 'get',
    params
  })
}

export function getCourseStatusSwitch(params) {
  return request({
    url: '/manager/course/info/status/switch/'+params.serverPlace+'/' + params.courseId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post'
  })
}

export function getCourseAdd(data) {
  return request({
    url: '/manager/course/info/add',
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getCourseEdit(data) {
  return request({
    url: '/manager/course/info/edit/' + data.courseId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getBannerList(data) {
  return request({
    url: '/manager/course/banner/list/'+data.serverPlace,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getBannerAdd(data) {
  return request({
    url: '/manager/course/banner/add/'+ data.serverPlace,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getBannerEdit(data) {
  return request({
    url: '/manager/course/banner/edit/'+ data.serverPlace + '/' + data.bannerId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getBannerSwitch(data) {
  return request({
    url: '/manager/course/banner/status/switch/'+ data.serverPlace + '/' + data.bannerId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post'
  })
}

export function getCourseUser(data) {
  return request({
    url: '/manager/user/query',
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getAddUser(data) {
  return request({
    url: '/manager/user/add',
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getUserStatusSwitch(data) {
  return request({
    url: '/manager/user/status/switch/'+ data.loginId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
  })
}

export function getUserInfo(data) {
  return request({
    url: '/manager/user/info/'+ data.loginId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getUserUpdate(data) {
  return request({
    url: 'manager/user/update/'+ data.loginId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data:{
      type:2,
      data:data
    }
  })
}

export function getVideoDel(data) {
  return request({
    url: 'manager/course/video/del/'+data.serverPlace+'/'+ data.videoId,
    headers: {
        'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
  })
}

export function getVideoEdit(data) {
  return request({
    url: 'manager/course/video/edit/'+data.serverPlace,
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    method: 'post',
    data
  })
}
